
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>登录</title>
	<link rel="stylesheet" type="text/css" href="css/registerlogin.css">
</head>
<body>
<div id="box"></div>
<div class="cent-box">
	<div class="cent-box-header">
		<h1>Office Automation</h1>
		<h2 class="sub-title">人事管理平台</h2>
	</div>

	<div class="cont-main clearfix">
		<div class="index-tab">
			<div class="index-slide-nav">
				<a href="login.html" class="active">登录</a>
				<a href="register.html">注册</a>
				<div class="slide-bar"></div>				
			</div>
		</div>
		<form onsubmit="return false">
		<div class="login form">
			<div class="group">
				<div class="group-ipt email">
					<input type="text" name="loginname" id="loginname" class="ipt" placeholder="请输入用户名" required>
				</div>
				<div class="group-ipt password">
					<input type="password" name="password" id="password" class="ipt" placeholder="请输入密码" required>
				</div>
			</div>
		</div>

		<div class="button">
			<button type="submit" class="login-btn register-btn" id="button">登录</button>
		</div>
		</form>

	</div>
</div>

<script src='js/particles.js' type="text/javascript"></script>
<script src='js/background.js' type="text/javascript"></script>
<script src='js/jquery.min.js' type="text/javascript"></script>
<script type="text/javascript" src="js/jquery-1.8.3.min.js">
</script>
<script>
	$("form").submit(function () {
		$.ajax({
			type:"post",
			url:"user/login.do",
			data:$("form").serialize(),
			dataType:"json",
			success:function(data) {
				//data就是后端返回的数据 {"code":1, "info":null}
				if (data.code == 1) {
					alert("登录成功！");
					window.location.href="index.html"
				} else {
					alert(data.info)
				}
			}
		})
	})
</script>
</body>
</html>